package com.javasm.service.stockService.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.javasm.common.page.PageResult;
import com.javasm.domin.criteria.stockCtriteria.PutStorageGoodsCriteria;
import com.javasm.domin.entity.stockEntity.PutStorageGoods;
import com.javasm.domin.vo.stockVo.PutStorageGoodsVo;
import com.javasm.mapper.stockMapper.PutStorageGoodsMapper;
import com.javasm.service.stockService.PutStorageGoodsService;
import com.javasm.transfer.stockTransfer.PutStorageGoodsTransfer;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
* @author Administrator
* @description 针对表【put_storage_goods】的数据库操作Service实现
* @createDate 2021-11-25 11:01:57
*/
@Service
@Transactional
public class PutStorageGoodsServiceImpl extends ServiceImpl<PutStorageGoodsMapper, PutStorageGoods>
    implements PutStorageGoodsService {
    @Resource
    private PutStorageGoodsMapper putStorageGoodsMapper;
    @Resource
    private PutStorageGoodsTransfer putStorageGoodsTransfer;

    @Override
    public PageResult<PutStorageGoodsVo> findByIdGoods(PutStorageGoodsCriteria putStorageGoodsCriteria) {
        List<PutStorageGoods> byIdGoods = putStorageGoodsMapper.findByIdGoods(putStorageGoodsCriteria.getId());
        List<PutStorageGoodsVo> putStorageGoodsVos = putStorageGoodsTransfer.toVO(byIdGoods);
        PageInfo<PutStorageGoodsVo> putStorageInfoPageInfo = new PageInfo<>(putStorageGoodsVos);
        PageHelper.startPage(putStorageGoodsCriteria.getCurrentPage(),putStorageGoodsCriteria.getPageSize());
        return new PageResult<>(putStorageInfoPageInfo.getTotal(),putStorageGoodsVos);
    }
}




